package frontend.components.menu;

import org.apache.wicket.markup.html.WebPage;

import shared.util.UIAuthUtil;

public class LinkItem implements MenuItem {

	private final String itemTitle;
	private final Class<? extends WebPage> linkedPage;

	public LinkItem(String itemTitle, Class<? extends WebPage> linkedPage) {
		this.itemTitle = itemTitle;
		this.linkedPage = linkedPage;
	}
	
	@Override
    public boolean isVisibleForLoggedInUser() {
		return UIAuthUtil.isUserAuthorizedForPage(getLinkedPage());
	}

	public String getItemTitle() {
		return itemTitle;
	}

	public Class<? extends WebPage> getLinkedPage() {
		return linkedPage;
	}

	@Override
    public boolean isLeaf() {
		return true;
	}

}
